Skip to content

Fix annotation updates when the end time changes - #2877

Open
nhoening wants to merge 1 commit into
mainfrom
fix/annotation-extending-existing
Open

nhoening wants to merge 1 commit into
mainfrom
fix/annotation-extending-existing

Conversation

@nhoening

Copy link
Copy Markdown
Member

Description

Posting an annotation with a changed end time can return HTTP 500. The lookup includes end and omits belief_time, while the database uniqueness constraint includes belief_time and excludes end. Extending an existing EV label from 07:00 to 07:15 therefore attempts a conflicting insert.

Align the lookup with the database identity: content, start, belief time, source and type. When an annotation already exists, update its end time and reuse it. Preserve separate annotations for different belief times.

Regression tests cover extending an annotation, repeating the request and preserving distinct belief times. The failure and fix were also reproduced locally using v1.1.1’s annotation model on an isolated SQLite database; the full server test suite has not been run.

Found while working on the HEMS script, as I made annotations longer.

  • fix updating/extending existing annotaitons - align annotation lookup…so it plays well with its database uniqueness constraint
  • Added changelog item in documentation/changelog.rst

… so it plays well with its database uniqueness constraint

Signed-off-by: Nicolas Höning <[email protected]>
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 flexmeasures | 🛠️ Build #35961142 | 📁 Comparing 3c71fe8 against latest (0321d69)

  🔍 Preview build  

2 files changed
± _autosummary/flexmeasures.data.models.annotations.html
± api/v3_0.html

@nhoening nhoening added this to the 1.2.0 milestone Nov 17, 2026
@nhoening nhoening added the Data label Nov 17, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant